﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Microsoft.Practices.ServiceLocation;
using MP3Ganizer.Common.Interfaces.Infrastructure;

namespace MP3Ganizer.Controls.Converters
{
    public class ObjectToCommandPanelConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var service =  ServiceLocator.Current.GetInstance<IManageCommandPanel>();
            IAmACommandPanel panel;
            if(service.TryToBuildACommandPanelByType(value, out panel))
                return panel;
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
